/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#ifndef __UMC_AVS_THREAD_H
#define __UMC_AVS_THREAD_H

#include "ippdefs.h"
#include "umc_thread.h"
#include "umc_structures.h"

namespace UMC
{

// forward declaration of used classes
class AVSFusionCore;
class Event;

class AVSThread : public Thread
{
public:
    // Constructor
    AVSThread(void);
    // Destructor
    virtual
    ~AVSThread(void);

    // Initialize the object
    Status Init(AVSFusionCore *pCore, Ipp32s iNumber);

    // Close the object and release all resources
    Status Close(void);

    // Give the thread a hint that it is a good time to sleep
    void GoSleep(Event &done);
    // Let the thread run again
    void WakeUp(Event &done);

    // Run the object by an external thread
    Status DoJob(void);

protected:
    // routine for running thread
    static
    Ipp32u VM_THREAD_CALLCONVENTION ThreadProc(void *);

    AVSFusionCore *m_pCore;                                     // (AVSFusionCore *) pointer to a fusion core

    volatile
    bool m_bQuit;                                               // (bool) exit flag
    volatile
    bool m_bSleep;                                              // (bool) it is good time to sleep
    Event *m_pSignal;                                           // (Event *) pointer to a sync object
    Ipp32s m_threadNum;                                         // (Ipp32s) ordinal number of thread
};

} // namespace UMC

#endif // __UMC_AVS_THREAD_H
